/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.anhanguera.tcc.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "tb_documento_fiscal")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DocumentoFiscal.findAll", query = "SELECT d FROM DocumentoFiscal d"),
    @NamedQuery(name = "DocumentoFiscal.findByIdDocumentoFiscal", query = "SELECT d FROM DocumentoFiscal d WHERE d.idDocumentoFiscal = :idDocumentoFiscal"),
    @NamedQuery(name = "DocumentoFiscal.findByNuDanfe", query = "SELECT d FROM DocumentoFiscal d WHERE d.nuDanfe = :nuDanfe"),
    @NamedQuery(name = "DocumentoFiscal.findByVlNfeBruto", query = "SELECT d FROM DocumentoFiscal d WHERE d.vlNfeBruto = :vlNfeBruto"),
    @NamedQuery(name = "DocumentoFiscal.findByVlNfeLiquido", query = "SELECT d FROM DocumentoFiscal d WHERE d.vlNfeLiquido = :vlNfeLiquido"),
    @NamedQuery(name = "DocumentoFiscal.findByVlIcms", query = "SELECT d FROM DocumentoFiscal d WHERE d.vlIcms = :vlIcms"),
    @NamedQuery(name = "DocumentoFiscal.findByVlDesconto", query = "SELECT d FROM DocumentoFiscal d WHERE d.vlDesconto = :vlDesconto"),
    @NamedQuery(name = "DocumentoFiscal.findByDtNfe", query = "SELECT d FROM DocumentoFiscal d WHERE d.dtNfe = :dtNfe"),
    @NamedQuery(name = "DocumentoFiscal.findByDtRecebimento", query = "SELECT d FROM DocumentoFiscal d WHERE d.dtRecebimento = :dtRecebimento")})
public class DocumentoFiscal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_DOCUMENTO_FISCAL")
    private Integer idDocumentoFiscal;
    @Basic(optional = false)
    @NotNull
    @Column(name = "NU_DANFE")
    private int nuDanfe;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "VL_NFE_BRUTO")
    private BigDecimal vlNfeBruto;
    @Basic(optional = false)
    @NotNull
    @Column(name = "VL_NFE_LIQUIDO")
    private BigDecimal vlNfeLiquido;
    @Column(name = "VL_ICMS")
    private BigDecimal vlIcms;
    @Column(name = "VL_DESCONTO")
    private BigDecimal vlDesconto;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DT_NFE")
    @Temporal(TemporalType.DATE)
    private Date dtNfe;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DT_RECEBIMENTO")
    @Temporal(TemporalType.DATE)
    private Date dtRecebimento;
    @OneToMany(mappedBy = "codDocumentoFiscal")
    private List<ComprovanteEntrega> comprovanteEntregaList;

    public DocumentoFiscal() {
    }

    public DocumentoFiscal(Integer idDocumentoFiscal) {
        this.idDocumentoFiscal = idDocumentoFiscal;
    }

    public DocumentoFiscal(Integer idDocumentoFiscal, int nuDanfe, BigDecimal vlNfeBruto, BigDecimal vlNfeLiquido, Date dtNfe, Date dtRecebimento) {
        this.idDocumentoFiscal = idDocumentoFiscal;
        this.nuDanfe = nuDanfe;
        this.vlNfeBruto = vlNfeBruto;
        this.vlNfeLiquido = vlNfeLiquido;
        this.dtNfe = dtNfe;
        this.dtRecebimento = dtRecebimento;
    }

    public Integer getIdDocumentoFiscal() {
        return idDocumentoFiscal;
    }

    public void setIdDocumentoFiscal(Integer idDocumentoFiscal) {
        this.idDocumentoFiscal = idDocumentoFiscal;
    }

    public int getNuDanfe() {
        return nuDanfe;
    }

    public void setNuDanfe(int nuDanfe) {
        this.nuDanfe = nuDanfe;
    }

    public BigDecimal getVlNfeBruto() {
        return vlNfeBruto;
    }

    public void setVlNfeBruto(BigDecimal vlNfeBruto) {
        this.vlNfeBruto = vlNfeBruto;
    }

    public BigDecimal getVlNfeLiquido() {
        return vlNfeLiquido;
    }

    public void setVlNfeLiquido(BigDecimal vlNfeLiquido) {
        this.vlNfeLiquido = vlNfeLiquido;
    }

    public BigDecimal getVlIcms() {
        return vlIcms;
    }

    public void setVlIcms(BigDecimal vlIcms) {
        this.vlIcms = vlIcms;
    }

    public BigDecimal getVlDesconto() {
        return vlDesconto;
    }

    public void setVlDesconto(BigDecimal vlDesconto) {
        this.vlDesconto = vlDesconto;
    }

    public Date getDtNfe() {
        return dtNfe;
    }

    public void setDtNfe(Date dtNfe) {
        this.dtNfe = dtNfe;
    }

    public Date getDtRecebimento() {
        return dtRecebimento;
    }

    public void setDtRecebimento(Date dtRecebimento) {
        this.dtRecebimento = dtRecebimento;
    }

    @XmlTransient
    public List<ComprovanteEntrega> getComprovanteEntregaList() {
        return comprovanteEntregaList;
    }

    public void setComprovanteEntregaList(List<ComprovanteEntrega> comprovanteEntregaList) {
        this.comprovanteEntregaList = comprovanteEntregaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDocumentoFiscal != null ? idDocumentoFiscal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DocumentoFiscal)) {
            return false;
        }
        DocumentoFiscal other = (DocumentoFiscal) object;
        if ((this.idDocumentoFiscal == null && other.idDocumentoFiscal != null) || (this.idDocumentoFiscal != null && !this.idDocumentoFiscal.equals(other.idDocumentoFiscal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.anhanguera.tcc.model.DocumentoFiscal[ idDocumentoFiscal=" + idDocumentoFiscal + " ]";
    }

}
